//
import { defineStore } from 'pinia'
import { storage } from '../utils'
export default defineStore('formSearchDataStore', {
  state: () => ({
    formSearchData: {} as any,
  }),
  actions: {
    loadState() {
      const data = storage.get('FORM_SEARCH_DATA', 'null');
      this.$patch({ formSearchData: JSON.parse(data) });
    },

    setAllState(newState: Partial<any>) {
      storage.set('FORM_SEARCH_DATA', JSON.stringify(newState))
      this.$patch({ formSearchData: newState });
    },
    getAllState(): any {
      this.loadState();
      return this.formSearchData;
    },
  },
})
